/*
 * BSM6.0
 *
 * Copyright 2012-2013 (C) SINODATA CO., LTD. All Rights Reserved.
 */
package com.sinodata.bsm.common.message;

import java.io.Serializable;

/**
 * <p>
 * Description: 
 * </p>
 *
 * @author tangli
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-7 下午4:29:50          tangli_ITSM        1.0         To create
 * </p>
 *
 * @since 
 * @see     
 */
public class ServiceMessage implements Serializable {
    private String srvId;
    private String method;
    private Object[] params;
    private boolean needReply = false;

    /**
     *
     */
    public ServiceMessage() {
    }

    /**
     * @return the params
     */
    public Object[] getParams() {
        return params;
    }

    /**
     * @param params the params to set
     */
    public void setParams(Object[] params) {
        this.params = params;
    }

    /**
     * @return the srvId
     */
    public String getSrvId() {
        return srvId;
    }

    /**
     * @param srvId the srvId to set
     */
    public void setSrvId(String srvId) {
        this.srvId = srvId;
    }

    /**
     * @return the method
     */
    public String getMethod() {
        return method;
    }

    /**
     * @param method the method to set
     */
    public void setMethod(String method) {
        this.method = method;
    }

    public boolean isNeedReply() {
        return needReply;
    }

    public void setNeedReply(boolean needReply) {
        this.needReply = needReply;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("request:service=");
        builder.append(this.srvId == null ? "NULL" : this.srvId);
        builder.append(";method=");
        builder.append(this.method == null ? "NULL" : this.method);
        builder.append(";parameters=");
        if (this.params == null) {
            builder.append("NULL");
        } else {
            for (int i = 0; i < this.params.length; i++) {
                Object p = this.params[i];
                builder.append("[");
                builder.append(p == null ? "NULL" : p.toString());
                builder.append("]");
            }
        }
        return builder.toString();
    }
}
